<?php
include('includes/functions.php');

$events = get_all_events(1);
$events = array_slice($events,0,7);
if (sizeof($events) == 0) {
	echo "<p>No upcomming events at this time. <a href='/calendar/add/'>Add one?</p>";
} else { 
	echo "<ul>\r\n";
}
foreach ($events as $event) {
	$date = explode_date($event['startdate']);
	echo "<li>\r\n";
	echo "<a href='/calendar/" . $date['year'] . "/" . $date['month'] . "/" . $date['day'] . "/'>" . date('M j',strtotime($event['startdate'])) . "</a>: ";
	echo "<a href='/calendar/" . $date['year'] . "/" . $date['month'] . "/" . $date['day'] . "/" . $event['slug'] . "/?height=300&width=450' title='" . $event['title'] . "'  class='thickbox'>" . $event['title'] . "</a>"; 
	if ($event['allday'] == 0) echo " (" . format_time($event['starttime']) . ")";
	echo "\r\n</li>\r\n";
}

if (sizeof($events) > 0) echo "</ul>";
?>
<center>- <a href='/calendar/'>Full Calendar</a> -</center>